home *** CD-ROM | disk | FTP | other *** search
/ IRIX 6.5 Complementary Applications 2004 February / SGI IRIX 6.5 Complementary Applications 2004 February.iso / dist / cde.idb / usr / dt / share / include / Xm / TextFP.h.z / TextFP.h
Encoding:
C/C++ Source or Header  |  2003-11-18  |  15.7 KB  |  386 lines

  1. /*
  2.  * TextFP.h
  3.  *
  4.  * Copyright 2000, Silicon Graphics, Inc.
  5.  * ALL RIGHTS RESERVED
  6.  * 
  7.  * UNPUBLISHED -- Rights reserved under the copyright laws of the United
  8.  * States.   Use of a copyright notice is precautionary only and does not
  9.  * imply publication or disclosure.
  10.  *
  11.  * U.S. GOVERNMENT RESTRICTED RIGHTS LEGEND:
  12.  * Use, duplication or disclosure by the Government is subject to restrictions
  13.  * as set forth in FAR 52.227.19(c)(2) or subparagraph (c)(1)(ii) of the Rights
  14.  * in Technical Data and Computer Software clause at DFARS 252.227-7013 and/or
  15.  * in similar or successor clauses in the FAR, or the DOD or NASA FAR
  16.  * Supplement.  Contractor/manufacturer is Silicon Graphics, Inc.,
  17.  * 2011 N. Shoreline Blvd. Mountain View, CA 94039-7311.
  18.  *
  19.  * THE CONTENT OF THIS WORK CONTAINS CONFIDENTIAL AND PROPRIETARY
  20.  * INFORMATION OF SILICON GRAPHICS, INC. ANY DUPLICATION, MODIFICATION,
  21.  * DISTRIBUTION, OR DISCLOSURE IN ANY FORM, IN WHOLE, OR IN PART, IS STRICTLY
  22.  * PROHIBITED WITHOUT THE PRIOR EXPRESS WRITTEN PERMISSION OF SILICON
  23.  * GRAPHICS, INC.
  24.  */
  25. /* 
  26.  * @OSF_COPYRIGHT@
  27.  * (c) Copyright 1990, 1991, 1992, 1993, 1994 OPEN SOFTWARE FOUNDATION, INC.
  28.  * ALL RIGHTS RESERVED
  29.  *  
  30. */ 
  31. /*
  32.  * HISTORY
  33.  * Motif Release 1.2.5
  34. */
  35. /*   $XConsortium: TextFP.h /main/cde1_maint/2 1995/08/18 19:26:38 drk $ */
  36. /*
  37. *  (c) Copyright 1987, 1988, 1989, 1990, 1991, 1992 HEWLETT-PACKARD COMPANY */
  38. #ifndef _XmTextFP_h
  39. #define _XmTextFP_h
  40.  
  41. #include <Xm/PrimitiveP.h>
  42. #include <Xm/TextF.h>
  43.  
  44. #ifdef __cplusplus
  45. extern "C" {
  46. #endif
  47.  
  48. /*
  49.  * Defines for different cursors
  50.  */
  51.  
  52. #define IBEAM_WIDTH 3
  53. #define CARET_WIDTH 9
  54. #define CARET_HEIGHT 5
  55.  
  56. #ifdef NOT_DEF
  57. static unsigned char caretBits[] = {
  58.    0x10, 0x00, 0x38, 0x00, 0x6c, 0x00, 0xc6, 0x00, 0x83, 0x01};
  59. #endif /* NOT_DEF */
  60.  
  61. /*
  62.  * Here is the Text Field Widget class structure.
  63.  */
  64.  
  65. typedef struct _XmTextFieldClassPart
  66.   {
  67.     XtPointer extension;        /* Pointer to extension record. */
  68.   }
  69.   XmTextFieldClassPart;
  70.  
  71. typedef struct _XmTextFieldClassRec
  72.   {
  73.     CoreClassPart core_class;  /* Not RectObjClassPart so I can reference
  74.                   core_class s */
  75.     XmPrimitiveClassPart primitive_class;
  76.     XmTextFieldClassPart text_class;
  77.   }
  78.   XmTextFieldClassRec;
  79.  
  80. externalref XmTextFieldClassRec xmTextFieldClassRec;
  81.  
  82. /*
  83.  * Here is the Text Field Widget instance structures.
  84.  */
  85.  
  86. typedef struct _XmTextFieldPart
  87.   {
  88.     XtCallbackList activate_callback;       /* Command activate callback */
  89.     XtCallbackList focus_callback;  /* Verify losing focus callback */
  90.     XtCallbackList losing_focus_callback;  /* Verify losing focus callback */
  91.     XtCallbackList modify_verify_callback; /* Verify value to change callback */
  92.     XtCallbackList wcs_modify_verify_callback; /* Verify value to change 
  93.                         * callback */
  94.     XtCallbackList motion_verify_callback; /* Verify insert cursor position to
  95.                           change callback */
  96.     XtCallbackList gain_primary_callback; /* Gained ownership of Primary
  97.                                              Selection */
  98.     XtCallbackList lose_primary_callback; /* Lost ownership of Primary
  99.                                              Selection */
  100.     XtCallbackList value_changed_callback; /* Notify that value has change                              callback */
  101.     char * value;        /* pointer to widget value stored as char* */
  102.     wchar_t * wc_value;        /* pointer to widget value stored as wchar_t* */
  103.  
  104.     XmFontList font_list;    /* Uses only the font portion of fontlist */
  105.     XFontStruct *font;            /* font retrieved from the fontlist */
  106.     XmTextScanType *selection_array; /* Description of what to cycle
  107.                          through on selections */
  108.     _XmHighlightData highlight;    /* Info on the highlighting regions. */
  109.  
  110.     GC gc;            /* Normal GC for drawing text and cursor */
  111.     GC image_gc;        /* Image GC for drawing text cursor*/
  112.     GC save_gc;                 /* GC for saving/restoring under IBeam */
  113.  
  114.     Pixmap ibeam_off;        /* pixmap for area under the IBeam */
  115.     Pixmap add_mode_cursor;    /* The add mode cursor pixmap */
  116.     Pixmap cursor;        /* The ibeam cursor stencil */
  117.     Pixmap putback;        /* AVAILABLE: was in 1.1 but not really used */
  118.     Pixmap stipple_tile;    /* The tile pattern for the stippled I-beam */
  119.     Pixmap image_clip;        /* The clip rect needed for image gc */
  120.  
  121.     XmTextPosition cursor_position;/* Character location of the insert cursor */
  122.     XmTextPosition new_h_offset;/* Used in setvaluesalmost proc */
  123.     XmTextPosition h_offset;      /* The x position of the first character
  124.                                    (relative to left edge of the widget) */
  125.     XmTextPosition orig_left;     /* Left primary selection prior to extend */
  126.     XmTextPosition orig_right;    /* Right primary selection prior to extend */
  127.     XmTextPosition prim_pos_left; /* Left primary selection position */
  128.     XmTextPosition prim_pos_right; /* Right primary selection position */
  129.     XmTextPosition prim_anchor;    /* Primary selection pivot point */
  130.  
  131.     XmTextPosition sec_pos_left; /* Left secondary selection position */
  132.     XmTextPosition sec_pos_right; /* Right secondary selection position */
  133.     XmTextPosition sec_anchor;    /* Secondary selection pivot point */
  134.  
  135.     XmTextPosition stuff_pos;    /* Position to stuff the primary selection */
  136.  
  137.     Position select_pos_x;    /* x position for timer-based scrolling */
  138.  
  139.     Time prim_time;             /* Timestamp of primary selection */
  140.     Time dest_time;             /* Timestamp of destination selection */
  141.     Time sec_time;              /* Timestamp of secondary selection */
  142.     Time last_time;             /* Time of last selection event */
  143.  
  144.     XtIntervalId timer_id;    /* Blinking cursor timer */
  145.     XtIntervalId select_id;     /* Timer based scrolling identifier */
  146.  
  147.     int blink_rate;        /* Rate of blinking text cursor in msec */
  148.     int selection_array_count;  /* Selection array count */
  149.     int threshold;        /* Selection threshold */
  150.     int size_allocd;        /* Size allocated for value string */
  151.     int string_length;          /* The number of characters in the string 
  152.                    (including the trailing NULL) */
  153.     int cursor_height;        /* Save cursor dimensions */
  154.     int cursor_width;        /* Save cursor dimensions */
  155.     int sarray_index;        /* Index into selection array */
  156.     int max_length;        /* Maximum number of character that can be
  157.                    inserted into the text field widget */
  158.  
  159.     int max_char_size;          /* Max bytes per character in cur locale */
  160.     short columns;        /* The number of characters in the width */
  161.  
  162.     Dimension margin_width;    /* Height between text borders and text */
  163.     Dimension margin_height;    /* Width between text borders and text */
  164.     Dimension average_char_width;/* Average character width based on font */
  165.     Dimension margin_top;   /* Height between text borders and top of text */
  166.     Dimension margin_bottom;/* Height between text borders and bottom of text */
  167.     Dimension font_ascent;  /* Ascent of font or fontset used by widget */
  168.     Dimension font_descent;  /* Descent of font or fontset used by widget */
  169.  
  170.     Boolean resize_width;    /* Allows the widget to grow horizontally
  171.                    when borders are reached */
  172.     Boolean pending_delete;    /* Delete primary selection on insert when
  173.                    set to True */
  174.     Boolean editable;        /* Sets editablility of text */
  175.     Boolean verify_bell;          /* Determines if bell is sounded when verify
  176.                                    *  callback returns doit - False
  177.                                    */
  178.     Boolean cursor_position_visible;    /* Sets visibility of insert cursor */
  179.  
  180.     Boolean traversed;          /* Flag used with losing focus verification to
  181.                                    indicate a traversal key pressed event */
  182.     Boolean add_mode;        /* Add mode for cursor movement */
  183.     Boolean has_focus;        /* Flag that indicates whether the widget
  184.                        has input focus */
  185.     Boolean blink_on;        /* State of Blinking insert cursor */
  186.     short int cursor_on;    /* Indicates whether the cursor is visible */
  187.     Boolean refresh_ibeam_off;    /* Indicates whether the area under IBeam needs
  188.                    to be re-captured */
  189.     Boolean have_inverted_image_gc;  /* fg/bg of image gc have been swapped */
  190.     Boolean has_primary;    /* Indicates that is has the
  191.                    primary selection */
  192.     Boolean has_secondary;    /* Indicates that is has the
  193.                    secondary selection */
  194.     Boolean has_destination;    /* Indicates that is has the
  195.                    destination selection */
  196.     Boolean sec_drag;           /* Indicates a secondary drag was made */ 
  197.     Boolean selection_move;    /* Indicates that the action requires a
  198.                    secondary move (i.e. copy & cut) */
  199.     Boolean pending_off;    /* indicates pending delete state */
  200.     Boolean fontlist_created;   /* Indicates that the text field widget created
  201.                    it's own fontlist */
  202.     Boolean has_rect;        /* currently has clipping rectangle */
  203.     Boolean do_drop;        /* Indicates that the widget the recieved the
  204.                    button release, did not have a previous
  205.                                    button press, so it is o.k. to request
  206.                    the MOTIF_DROP selection. */
  207.     Boolean cancel;        /* Cancels selection actions when true */
  208.     Boolean extending;        /* Indicates extending primary selection */
  209.     Boolean sec_extending;      /* Indicates extending secondary selection */
  210.     Boolean changed_visible;    /* Indicates whether the dest_visible flag
  211.                                    is in a temporary changed state */
  212.     Boolean have_fontset;       /* The widgets font is a fontset, not a 
  213.                  * fontstruct... use R5 draw routines */
  214.     Boolean in_setvalues;    /* used to disable unnecessary redisplays */
  215.     Boolean do_resize;        /* used to prevent inappropriate resizes */
  216.     Boolean redisplay;        /* used to set redisplay flag in setvalues */
  217.     Boolean overstrike;        /* overstrike mode for character input */
  218.     Boolean sel_start;        /* overstrike mode for character input */
  219.     XtPointer extension;    /* Pointer to extension record. */
  220.   }
  221.   XmTextFieldPart;
  222.  
  223. typedef struct _XmTextFieldRec
  224.   {
  225.     CorePart core;
  226.     XmPrimitivePart primitive;
  227.     XmTextFieldPart text;
  228.   }
  229.   XmTextFieldRec;
  230.  
  231. /****************
  232.  *
  233.  * Macros for the uncached data
  234.  *
  235.  ****************/
  236.  
  237. #define TextF_ActivateCallback(tfg)        (((XmTextFieldWidget)(tfg)) -> \
  238.                        text.activate_callback)
  239. #define TextF_LosingFocusCallback(tfg)        (((XmTextFieldWidget)(tfg)) -> \
  240.                        text.losing_focus_callback)
  241. #define TextF_FocusCallback(tfg)        (((XmTextFieldWidget)(tfg)) -> \
  242.                        text.focus_callback)
  243. #define TextF_ModifyVerifyCallback(tfg)            (((XmTextFieldWidget)(tfg)) -> \
  244.                        text.modify_verify_callback)
  245. #define TextF_ModifyVerifyCallbackWcs(tfg)      (((XmTextFieldWidget)(tfg)) -> \
  246.                        text.wcs_modify_verify_callback)
  247. #define TextF_MotionVerifyCallback(tfg)            (((XmTextFieldWidget)(tfg)) -> \
  248.                        text.motion_verify_callback)
  249. #define TextF_ValueChangedCallback(tfg)            (((XmTextFieldWidget)(tfg)) -> \
  250.                        text.value_changed_callback)
  251. #define TextF_Value(tfg)                        (((XmTextFieldWidget)(tfg)) -> \
  252.                        text.value)
  253. #define TextF_WcValue(tfg)                      (((XmTextFieldWidget)(tfg)) -> \
  254.                        text.wc_value)
  255. #define TextF_MarginHeight(tfg)                (((XmTextFieldWidget)(tfg)) -> \
  256.                        text.margin_height)
  257. #define TextF_MarginWidth(tfg)            (((XmTextFieldWidget)(tfg)) -> \
  258.                        text.margin_width)
  259. #define TextF_CursorPosition(tfg)        (((XmTextFieldWidget)(tfg)) -> \
  260.                        text.cursor_position)
  261. #define TextF_Columns(tfg)            (((XmTextFieldWidget)(tfg)) -> \
  262.                        text.columns)
  263. #define TextF_MaxLength(tfg)            (((XmTextFieldWidget)(tfg)) -> \
  264.                        text.max_length)
  265. #define TextF_BlinkRate(tfg)            (((XmTextFieldWidget)(tfg)) -> \
  266.                        text.blink_rate)
  267. #define TextF_FontList(tfg)            (((XmTextFieldWidget)(tfg)) -> \
  268.                        text.font_list)
  269. #define TextF_Font(tfg)                (((XmTextFieldWidget)(tfg)) -> \
  270.                        text.font)
  271. #define TextF_FontAscent(tfg)            (((XmTextFieldWidget)(tfg)) -> \
  272.                        text.font_ascent)
  273. #define TextF_FontDescent(tfg)            (((XmTextFieldWidget)(tfg)) -> \
  274.                        text.font_descent)
  275. #define TextF_SelectionArray(tfg)        (((XmTextFieldWidget)(tfg)) -> \
  276.                        text.selection_array)
  277. #define TextF_SelectionArrayCount(tfg)        (((XmTextFieldWidget)(tfg)) -> \
  278.                        text.selection_array_count)
  279. #define TextF_ResizeWidth(tfg)            (((XmTextFieldWidget)(tfg)) -> \
  280.                        text.resize_width)
  281. #define TextF_PendingDelete(tfg)        (((XmTextFieldWidget)(tfg)) -> \
  282.                        text.pending_delete)
  283. #define TextF_Editable(tfg)            (((XmTextFieldWidget)(tfg)) -> \
  284.                        text.editable)
  285. #define TextF_CursorPositionVisible(tfg)    (((XmTextFieldWidget)(tfg)) -> \
  286.                        text.cursor_position_visible)
  287. #define TextF_Threshold(tfg)               (((XmTextFieldWidget)(tfg)) -> \
  288.                        text.threshold)
  289. #define TextF_UseFontSet(tfg)               (((XmTextFieldWidget)(tfg)) -> \
  290.                        text.have_fontset)
  291.  
  292. /********    Private Function Declarations    ********/
  293. #ifdef _NO_PROTO
  294.  
  295. extern int _XmTextFieldCountBytes() ;
  296. extern Widget _XmTextFieldGetDropReciever() ;
  297. extern void _XmTextFToggleCursorGC() ;
  298. extern void _XmTextFieldDrawInsertionPoint() ;
  299. extern void _XmTextFieldSetClipRect() ;
  300. extern void _XmTextFieldSetCursorPosition() ;
  301. extern Boolean _XmTextFieldReplaceText() ;
  302. extern void _XmTextFieldDeselectSelection() ;
  303. extern Boolean _XmTextFieldSetDestination() ;
  304. extern void _XmTextFieldStartSelection() ;
  305. extern void _XmTextFieldSetSel2() ;
  306.  
  307. #else
  308.  
  309. extern int _XmTextFieldCountBytes( 
  310.                         XmTextFieldWidget tf,
  311.                         wchar_t *wc_value,
  312.                         int num_chars) ;
  313. extern Widget _XmTextFieldGetDropReciever( 
  314.                         Widget w) ;
  315. extern void _XmTextFToggleCursorGC( 
  316.                         Widget widget) ;
  317. extern void _XmTextFieldDrawInsertionPoint( 
  318.                         XmTextFieldWidget tf,
  319. #if NeedWidePrototypes
  320.                         int turn_on) ;
  321. #else
  322.                         Boolean turn_on) ;
  323. #endif /* NeedWidePrototypes */
  324. extern void _XmTextFieldSetClipRect( 
  325.                         XmTextFieldWidget tf) ;
  326. extern void _XmTextFieldSetCursorPosition( 
  327.                         XmTextFieldWidget tf,
  328.                         XEvent *event,
  329.                         XmTextPosition position,
  330. #if NeedWidePrototypes
  331.                         int adjust_flag,
  332.                         int call_cb) ;
  333. #else
  334.                         Boolean adjust_flag,
  335.                         Boolean call_cb) ;
  336. #endif /* NeedWidePrototypes */
  337. extern Boolean _XmTextFieldReplaceText( 
  338.                         XmTextFieldWidget tf,
  339.                         XEvent *event,
  340.                         XmTextPosition replace_prev,
  341.                         XmTextPosition replace_next,
  342.                         char *insert,
  343.                         int insert_length,
  344. #if NeedWidePrototypes
  345.                         int move_cursor) ;
  346. #else
  347.                         Boolean move_cursor) ;
  348. #endif /* NeedWidePrototypes */
  349. extern void _XmTextFieldDeselectSelection( 
  350.                         Widget w,
  351. #if NeedWidePrototypes
  352.                         int disown,
  353. #else
  354.                         Boolean disown,
  355. #endif /* NeedWidePrototypes */
  356.                         Time sel_time) ;
  357. extern Boolean _XmTextFieldSetDestination( 
  358.                         Widget w,
  359.                         XmTextPosition position,
  360.                         Time set_time) ;
  361. extern void _XmTextFieldStartSelection( 
  362.                         XmTextFieldWidget tf,
  363.                         XmTextPosition left,
  364.                         XmTextPosition right,
  365.                         Time sel_time) ;
  366. extern void _XmTextFieldSetSel2( 
  367.                         Widget w,
  368.                         XmTextPosition left,
  369.                         XmTextPosition right,
  370. #if NeedWidePrototypes
  371.                         int disown,
  372. #else
  373.                         Boolean disown,
  374. #endif /* NeedWidePrototypes */
  375.                         Time sel_time) ;
  376.  
  377. #endif /* _NO_PROTO */
  378. /********    End Private Function Declarations    ********/
  379.  
  380.  
  381. #ifdef __cplusplus
  382. }  /* Close scope of 'extern "C"' declaration which encloses file. */
  383. #endif
  384.  
  385. #endif /* _XmTextFieldWidgetP_h */
  386.